import Vue from 'vue'
import Router from 'vue-router'
import store from './store'

import Login from './views/login/Login.vue';
import Header from './views/layout/Header.vue';
import AccountList from './views/account/AccountList.vue';
import AccountEdit from './views/account/AccountEdit.vue';
import RoleList from './views/role/RoleList.vue';
import RoleEdit from './views/role/RoleEdit.vue';
import NoticeList from './views/notice/NoticeList.vue';
import NoticeEdit from './views/notice/NoticeEdit.vue';
import OrganSetting from './views/organ/OrganSetting.vue';
import BannerList from './views/banner/BannerList.vue';
import BannerEdit from './views/banner/BannerEdit.vue';
import CommunityList from './views/community/CommunityList.vue';
import CommunityEdit from './views/community/CommunityEdit.vue';
import GridList from './views/community/GridList.vue';
import GridEdit from './views/community/GridEdit.vue';
import BasicData from './views/layout/BasicData.vue';
import NewsList from './views/news/NewsList.vue';
import NewsEdit from './views/news/NewsEdit.vue';
import CommunityNoticeList from './views/community/CommunityNoticeList.vue';
import CommunityNoticeEdit from './views/community/CommunityNoticeEdit.vue';
import Volunteer from './views/community/Volunteer.vue';
import ServiceList from './views/community/volunteer/ServiceList.vue';
import ServiceEdit from './views/community/volunteer/ServiceEdit.vue';
import SignList from './views/community/volunteer/SignList.vue';
import UserList from './views/user/UserList.vue';
import SchoolList from './views/basicdata/SchoolList.vue';
import SchoolEdit from './views/basicdata/SchoolEdit.vue';
import PersonList from './views/basicdata/PersonList.vue';
import PersonEdit from './views/basicdata/PersonEdit.vue';
import HouseList from './views/basicdata/HouseList.vue';
import HouseEdit from './views/basicdata/HouseEdit.vue';
import CompanyList from  './views/basicdata/CompanyList.vue';
import CompanyEdit from './views/basicdata/CompanyEdit.vue';
import HospitalList from './views/basicdata/HospitalList.vue';
import HospitalEdit from './views/basicdata/HospitalEdit.vue';
import SpecialPersonList from './views/basicdata/SpecialPersonList.vue';
import InterviewRecord from './views/basicdata/InterviewRecord.vue';
import ServiceTeamList from './views/basicdata/ServiceTeamList.vue';
import ServiceTeamEdit from './views/basicdata/ServiceTeamEdit.vue';
import Menu from './views/layout/Menu.vue';
import Main from './views/layout/Main.vue';
import DataCenter from './views/datacenter/DataCenter.vue';
import RandomPictureList from './views/community/RandomPictureList.vue';
import RandomPictureDetail from './views/community/RandomPictureDetail.vue';
import CommentList from './views/community/CommentList.vue';
import CommentEdit from './views/community/CommentEdit.vue';
//20201225添加，加入人员类别
import PersonTypeList from './views/basicdata/PersonTypeList.vue';
import PersonTypeEdit from './views/basicdata/PersonTypeEdit.vue';
//20210109添加，加入网格员日志
import LogList from './views/log/LogList.vue';
//20210111添加，加入我要办事设置
import WorkSetting from './views/organ/WorkSetting.vue';

Vue.use(Router)

//解决重复点击菜单报错的问题
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default  new Router({
    //嵌套路由，设置布局
    //mode: 'history',
    routes: [
        {
            path: '/',
            name:'layout',
            component:Menu,
            children:[
                //用户中心
                {
                    path: 'userlist',
                    name: 'userlist',
                    component:UserList
                },
                //用户列表
                {
                    path:'accountlist',
                    name:'accountlist',
                    component: AccountList
                },
                {
                    path:'accountEdit',
                    name:'accountEdit',
                    component: AccountEdit
                },
                //角色列表
                {
                    path:'rolelist',
                    name:'rolelist',
                    component: RoleList
                },
                {
                    path:'roleedit',
                    name:'roleedit',
                    component: RoleEdit
                },
                //日志列表
                {
                    path:'loglist',
                    name:'loglist',
                    component: LogList
                },
                //公告列表
                {
                    path:'noticelist',
                    name:'noticelist',
                    component:NoticeList
                },
                {
                    path:'noticeedit',
                    name:'noticeedit',
                    component: NoticeEdit
                },
                //机构设置
                {
                    path:'organsetting',
                    name:'organsetting',
                    component:OrganSetting
                },
                {
                    path:'worksetting',
                    name:'worksetting',
                    component:WorkSetting
                },
                //资讯管理
                {
                    path:'newslist',
                    name:'newslist',
                    component:NewsList
                },
                {
                    path:'newsedit',
                    name:'newsedit',
                    component:NewsEdit
                },
                //banner图设置
                {
                    path:'bannerlist',
                    name:'bannerlist',
                    component:BannerList
                },
                {
                    path:'banneredit',
                    name:'banneredit',
                    component:BannerEdit
                },
                //社区管理
                {
                    path:'communitylist',
                    name:'communitylist',
                    component:CommunityList
                },
                {
                    path:'communityedit',
                    name:'communityedit',
                    component:CommunityEdit
                },
                //网格管理
                {
                    path:'gridlist',
                    name:'gridlist',
                    component:GridList
                },
                {
                    path:'gridedit',
                    name:'gridedit',
                    component:GridEdit
                },
                //社区公告
                {
                    path:'communitynoticelist',
                    name:'communitynoticelist',
                    component:CommunityNoticeList
                },
                {
                    path:'communitynoticeedit',
                    name:'communitynoticeedit',
                    component:CommunityNoticeEdit
                },
                //志愿服务
                {
                    path:'volunteer',
                    name:'volunteer',
                    component:Volunteer,
                    children:[
                      {
                        path:'servicelist',
                        name:'servicelist',
                        component:ServiceList
                      },
                      {
                        path:'serviceedit',
                        name:'serviceedit',
                        component:ServiceEdit
                      },
                      {
                        path:'signlist',
                        name:'signlist',
                        component:SignList
                      }
                    ]
                },
                //随手拍
                {
                    path:'randompicturelist',
                    name:'randompicturelist',
                    component:RandomPictureList
                },
                {
                    path:'randompicturedetail',
                    name:'randompicturedetail',
                    component:RandomPictureDetail
                },
                //服务评论
                {
                    path:'commentlist',
                    name:'commentlist',
                    component:CommentList
                },
                {
                    path:'commentedit',
                    name:'commentedit',
                    component:CommentEdit
                },
                {
                    path:'persontypelist',
                    name:'persontypelist',
                    component:PersonTypeList
                },
                {
                    path:'persontypeedit',
                    name:'persontypeedit',
                    component:PersonTypeEdit
                },
                //基础数据
                {
                    path:'basicdata',
                    name:'basicdata',
                    component:BasicData,
                    children:[
                        //服务团队
                        {
                            path:'serviceteamlist',
                            name:'serviceteamlist',
                            component:ServiceTeamList
                        },
                        {
                            path:'serviceteamedit',
                            name:'serviceteamedit',
                            component:ServiceTeamEdit
                        },
                        //学校
                        {
                            path:'schoollist',
                            name:'schoollist',
                            component:SchoolList
                        },
                        {
                            path:'schooledit',
                            name:'schooledit',
                            component:SchoolEdit
                        },
                        //人口信息
                        {
                            path:'personlist',
                            name:'personlist',
                            component:PersonList
                        },
                        {
                            path:'personedit',
                            name:'personedit',
                            component:PersonEdit
                        },
                        //特殊人群
                        {
                            path:'specialpersonlist',
                            name:'specialpersonlist',
                            component:SpecialPersonList
                        },
                        {
                            path:'interviewrecord',
                            name:'interviewrecord',
                            component:InterviewRecord
                        },
                        //房屋信息
                        {
                            path:'houselist',
                            name:'houselist',
                            component:HouseList
                        },
                        {
                            path:'houseedit',
                            name:'houseedit',
                            component:HouseEdit
                        },
                        //单位
                        {
                            path:'companylist',
                            name:'companylist',
                            component:CompanyList
                        },
                        {
                            path:'companyedit',
                            name:'companyedit',
                            component:CompanyEdit
                        },
                        //学校
                        {
                            path:'hospitallist',
                            name:'hospitallist',
                            component:HospitalList
                        },
                        {
                            path:'hospitaledit',
                            name:'hospitaledit',
                            component:HospitalEdit
                        },
                    ]
                },
                {
                    path:'datacenter',
                    name:'datacenter',
                    component:DataCenter
                },
            ]
        },
        {
            path:'/login',
            name:'login',
            component:Login
        },
        //中间页面
        {
            path:'/main',
            name:'main',
            component:Main
        },
    ]
})
